<?php
//商城会员控制器
class OrderAction extends Action {
	
    public function index(){
        $uid = $_SESSION['uid'];
        $db = M('order');
        $orderData = $db->where(array('id'=>$_SESSION['oid']))->find();
        $orderGds = M('order_list')->where(array('oid'=>$orderData['id']))->select();
        $gsimg = M('intro');
        foreach($orderGds as $key=>$val){
            $tmpData = $gsimg->where(array('gid'=>$val['gid']))->field('mini')->find();
            $gspics = explode('|', $tmpData['mini']);
            $orderGds[$key]['gspic'] = $gspics[0];
        }
        $this->orderData = $orderData;
        // p($orderData);die;
      	$this->display();
    }

    public function buy(){
        $oid = $_SESSION['oid'];
        $db = M('order');
        $result = $db->where(array('id'=>$oid))->save(array('status'=>2));
        echo $result;
    }

     public function sh(){
        $oid = $_SESSION['oid'];
        $db = M('order');
        $result = $db->where(array('id'=>$oid))->save(array('status'=>4));
        echo $result;
    }
}
?>